import { Container, Graphics, IDestroyOptions } from "pixi.js";
import { useToolStore } from "../../ToolBox/Tool";
import { hub } from "../hub";

export class SystemLayer extends Container {
    brushShower = new Graphics();
    constructor() {
        super();
        hub.on("refreshBrush", this.getBrushStyle);
        hub.emit("refreshBrush");
        this.createBruchShower();
    }
    createBruchShower() {
        this.brushShower.position.set(100, 100);
        this.addChild(this.brushShower);
    }
    getBrushStyle = () => {
        useToolStore().usingTool.drawStyle(this.brushShower);
    };
    destroy(options?: boolean | IDestroyOptions): void {
        super.destroy.call(this, options);
        hub.off("refreshBrush", this.getBrushStyle.bind(this));
    }
}
